package com.uphone.kingmall.adapter;

import android.text.TextUtils;
import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.china.zhuoyue.R;
import com.uphone.kingmall.bean.WalletRecoedBean;
import com.uphone.kingmall.utils.ConstansUtils;
import com.uphone.kingmall.utils.GlideUtils;

import java.util.Map;

/**
 * <pre>
 *     author : 王雨
 *     e-mail :
 *     time   : 2018/07/31
 *     desc   :
 *     version: 1.0
 * </pre>
 */
public class YongJinListAdapter extends BaseQuickAdapter<WalletRecoedBean.DataBean, BaseViewHolder> {

    public YongJinListAdapter() {
        super(R.layout.kingmall_item_yoingjin);
    }

    @Override
    protected void convert(BaseViewHolder helper, WalletRecoedBean.DataBean item) {
        Map<Integer, String> walletType = ConstansUtils.getWalletType();
        String typevalue = walletType.get(item.getResumeType());
        if (!TextUtils.isEmpty(typevalue)) {
            helper.setText(R.id.tv_type, "" + typevalue);
        } else {
            helper.setText(R.id.tv_type, "");
        }
        if (item.getMoney() >= 0) {
            helper.setText(R.id.tv_jine, "+" + item.getMoney());
        } else {
            helper.setText(R.id.tv_jine, "" + item.getMoney());
        }
        helper.setText(R.id.tv_title, item.getUserName() + "");
        helper.setText(R.id.tv_date, "" + item.getCreateTime());
        ImageView iv_icon = helper.getView(R.id.iv_icon);
        GlideUtils.getInstance().loadCircleImage(mContext, item.getUserPhoto(), iv_icon);

    }
}
